<?php
if (isset($_GET['o']) &&  !empty($_GET['o']) ){
    include 'load.php';
    $openid=$_GET['o'];
    $hashui=addslashes($_GET['hashui']);
    $mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
    if (!$mysqli->set_charset("utf8")) {}
    $query=$mysqli->query("SELECT nickname,avatar FROM users where openid='".$openid."' limit 0,1 ");
    $isU=1; //已授权
    if($query->num_rows>0){
        $getU=$query->fetch_array();
        if (empty($getU['nickname']) && empty($getU['avatar'])){
            $isU=2; //未授权
        }
    }else{
        $isU=2; //未授权
    }
    $go='';
    if(1 == $isU){
      if('not' == $hashui){
        $query=$mysqli->query("SELECT memberno,phone FROM uinfo where openid='".$openid."' limit 0,1 ");
        if($query->num_rows>0){
            $getUinfo=$query->fetch_array();
            if (empty($getUinfo['memberno']) &&  !empty($getUinfo['phone'])){
                $go='goreg';
            }
        }
      }
    }
    $mysqli->close();
    echo json_encode(array('u'=>$isU,'g'=>$go));
}

